<template>
  <div>
    <HeaderTitle title="基础信息"></HeaderTitle>
    <a-row style="font-size: 15px; font-width: 700">
      <span style="padding: 0 15px" v-for="item in specimenFields"> {{ item.name }} : {{ formState[item.key] }} </span>
    </a-row>
    <div style="margin: 15px">
      <span style="vertical-align: top">检测结果 : </span>
      <div style="width: 900px; display: inline-block">
        <a-textarea size="small" v-model:value="value2" placeholder="请输入检测结果" :auto-size="{ minRows: 2, maxRows: 5 }"
          show-count :maxlength="200" />
      </div>
    </div>
    <HighCameracopy ref="HighCamera" :routerRecord="true" highCameraId="inputManageHighCamera"
      canvasCameraId="inputManageCanvasCamera" :registrationRecords="true" :billType="1"> </HighCameracopy>

    <div style="text-align: center">
      <a-button style="margin-right: 10px" @click="cancel">取消</a-button>
      <a-button @click="submit" type="primary">保存</a-button>
    </div>
  </div>
</template>
<script setup lang="tsx">
import HeaderTitle from '@/components/headerTitle.vue';
import { ref, defineEmits } from 'vue';
import HighCameracopy from '@/components/photograph/HighCameracopy.vue';
import { postfile } from '../api/registration_sample';
import { instance } from '../api/index';
const emit = defineEmits(['cancel']);
const props = defineProps({
  formState: {
    type: Object,
    default: () => {
      return {};
    },
  },
});
const HighCamera = ref();
const specimenFields = ref([
  { id: 1, name: '样本编号', key: 'originalSerial' },
  { id: 2, name: '样本名称', key: 'specimenName' },
  { id: 3, name: '容量', key: 'capacity' },
  { id: 4, name: '样本类型', key: 'specimen_type' },
  { id: 5, name: '采样日期', key: 'sampleTime' },
  { id: 6, name: '数字编号', key: 'serial' },
]);
const value2 = ref<string>('');
// 保存
const submit = async () => {
  let fileIds = HighCamera.value.record.refreshDataList.map((item) => item.id);
  await postfile({ id: props.formState.id, fileIds, overrideOld: 1 });
  await instance({ id: props.formState.id, check_result: value2.value });
  cancel();
};
//取消
const cancel = () => {
  value2.value = '';
  emit('cancel');
};
</script>
<style lang="less" scoped>
div {}

.bon {
  width: 100px;
  height: 100px;
}
</style>
